<?php

namespace App\Admin\Controllers;

use App\Admin\Metrics\ProjectDesc;
use App\Http\Controllers\Controller;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Grid;
use App\Models\Project;
use App\Models\Device;
use Dcat\Admin\Widgets\Card;
use Dcat\Admin\Widgets\Box;
use Dcat\Admin\Admin;


class ProjectLocationController extends Controller
{
    public function index(Content $content, $projectId){
        session()->put('now_project', $projectId);
        $project = Project::find($projectId);
        return $content
            ->header($project['projectname'])
            ->description('')
            ->body(function (Row $row) {
                $row->column(12, function (Column $column) {
                    // $column->row(function(Row $row) {
                    //     $row->column(0, $this->deviceInfo());
                    //     $row->column(0, $this->alertInfo());
                    //     $row->column(0, $this->taskInfo());
                    // });


                    $column->row(function(Row $row) {
                        $row->column(3, function (Column $column) {
                            $column->row(new ProjectDesc\DeviceCard());
                            $column->row(new ProjectDesc\DeviceCollection());
                        });
                        $row->column(6, $this->map());
                        $row->column(3, function (Column $column) {
                            $column->row(new ProjectDesc\DeviceAlertCard());
                            $column->row($this->alertLogInfo());
                        });
                    });
                });

            });
    }
}